package com.bw.common.aliPay;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {

//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
    public static String app_id = "2016102600766096";

    // 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCOgkiHfswzmlKhlGCDRJ2ZIVw9W8AE4E6ltULulF6xfYWnQsUo/zlGPmTj2QuuysabzSTYHZMyeQcn0FeixPLknhDhE439j9hHwIekAZQQR1vG53CFiv3hhJDxilgS3pTGCNrlWtoi2Vq2P+YklXFM58kuO6TGwRHlfDNgAMGv3GhNWy0kVshwsNmMyjgYiXB5nrtp+R2mwGdHYZVAlHJbewuQuFDRl3IeKCEv8r5oC8YleSo+mffw4wPd67msUugK5fTjE5AqW2tVSlJCP+e3rCTDxVa1NE1c4OO7d4F3XVMFaEVlItBWTmmCoNd7G9OktitehGAGLlsmTLemZ70BAgMBAAECggEAAVkiLoX4kJRpK7Yno5ZGl2hFYx83FdS5ab/pPjCRJMS3Ovnau6SOeiek9LLc9W5dqqOqMZE2D0gt1SaXbabHVXpZVofE1B1EQomDvv101SKXr64I1nqWJEgIxwA0DRml9qmmyHyvi5zaytaX6sivJbcbpCBUUr0I2k7ufX4EVxGO+jP+edLFr/5cv9AmSls5BdA64nozToBqwpN+HcZ4hMQgKHcM+E+W4l6KHO5mw4WNqxEM4jRFa3UMOpMx5To33XBk7Z7wjLoX0E1iR2YqKuUajfhgevTymDzro9lsVkpMnmsLwz7LsZ8d6Dx/i6nQNm2QFQBKSiSwiuqs0BpQQQKBgQD76wInlPonDTvpGk+QDC1HvmCXoEgRGl35FlD9QthMIHLKY2zei+/umdgrZO9RiJ3xptYxKs0DoT56CSeAfIaXUjaekbWKgov0vBZCXq+MPCFR30GdTnycfOKkCk2VqlTl4guzvuLLNkbBsypfrWIPgUpTMJfhwgUmHfTFki8RDQKBgQCQ0W42W6WA3afVH4cAM1+3/nENMvJgfaJSh6uPNaW7MNtHihyb03ZMNHJx4extuvZsL+NoCxDTZBhH7CCE/I0aXBZpTh5dVCN46aNOU7C+JE7EaRW0uLVmEBcSx9jqRIMYnBFYjGtmZeODvfQUo9/N8sqaAtQDCsanKAwVRHqWxQKBgQCr/tr8vVlBmmaCE2Wo+rdbmV6Hh3ZMvwzUCOmI0L+u0iSti86D71UEOeN+VS6UI0t69qac8RUCWm+2kFN5BQw7enUyNFeXVuRJVrV34P/IJjG1nVFGHpUznox65VHtUlsejQPiV/yuM8OBclsG8fDWlzZwr+eyym4LhT5eOh2KbQKBgBy5XZnsjaRE0tBEA5v3lKnDDxtmGosnADZMcKvkIS5C34uOCmSiCdnNoVGTVTjil5QX34w4fargNKy3Wi/mg/pRf6R9eSpb0PlfpiOYF/tu6iytB0AkTt6inGD+QLkew73y3sHogDj8RqdP2wTpCDAqUyM/IlxEG+j12YeyYHpdAoGAKWmr8p8k/3g6RdvSQ0Li1JprQz9ihTUTHOZsZe9aDo8ZYvr8q5oNcr9+MwrndPjvi0fPSF7uZSlI/MzrAcNQtvzoXl+I3bQr2MK4eBjH06ekRE2J27tpnW5GSZrWpUHZ/zzDhrewC1I1YS55TcoIBpEua5gML1bSat23O2rIy3M=";

    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA8MfCPHE0iu3jYQ5OyQHzgLTzmBDg73nTmWi33p/IsaUlysCk9apuS8KGYhb0HGrokaWbBgOH65N6skZXAD7od+/sVTaYhAaGvRQLyBEO4hzye83o9w4uU3m7bRIYgQmJot52SDZ6o9wo3tInxxBc1+Q4aMq7BrfApg654MaS+T4KdE9h3vboaX3SFajsGKpX+/ZezXXXuyZbd1Qdt5C9ZqLJccJm2oSiXSNs6L8vxAIEjvSISnRPMhEDLq5SHQ92QSbvhpcJDmAlv32Sbl64Dgjm31kj4bQoEu6FRNzxpcZCJ++sG/35svyDv3UXd8gQikGmmB698lJCovl55QJwFwIDAQAB";

    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String notify_url = "http://localhost:8080/payLog/checkNotify";

    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String return_url = "http://localhost:8888/#/payReturn";

    // 签名方式
    public static String sign_type = "RSA2";

    // 字符编码格式
    public static String charset = "utf-8";

    // 支付宝网关
    public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";

    // 支付宝网关
    public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

